﻿package plugin.bossChallenge.ui
{
    import com.core.*;
    import flash.display.*;
    import flash.events.*;
    import uiresource.boss.*;

    public class BossItemCtrl extends BossItemUI
    {
        private var cfgBossChallenge:Array;
        private var cfgMonster:Array;
        private var cfgInstance:Array;
        private var cfgMapList:Array;
        private var cfgItems:Object;
        public var index:int = 0;
        private var oldname:String = "";
        private var _data:Object;

        public function BossItemCtrl()
        {
            this.cfgBossChallenge = ConfigDictionary.data.bosschallenge;
            this.cfgMonster = ConfigDictionary.data.monster;
            this.cfgInstance = ConfigDictionary.data.instance;
            this.cfgMapList = ConfigDictionary.data.maplist;
            this.cfgItems = ConfigDictionary.data.item;
            return;
        }// end function

        public function get data() : Object
        {
            return this._data;
        }// end function

        public function set data(param1:Object) : void
        {
            var _loc_2:Loader = null;
            if (this.cfgBossChallenge[param1.bossId].bossname == this.oldname)
            {
                return;
            }
            this._data = param1;
            btn.label = this.cfgBossChallenge[this._data.bossId].bossname;
            countLable.mouseEnabled = false;
            this.oldname = this.cfgBossChallenge[this._data.bossId].bossname;
            return;
        }// end function

        override protected function initialize() : void
        {
            super.initialize();
            btn.addEventListener(MouseEvent.CLICK, this.onClick);
            return;
        }// end function

        private function onClick(event:MouseEvent) : void
        {
            ModelProxy.change("bossChallenge", "selectItem", {data:this.data});
            return;
        }// end function

    }
}
